The present invention relates to a method for monitoring a monitored area, comprising the steps of recording an image of the monitored area and of comparing the recorded image with a reference image in order to determine if there is an alarm situation. The invention further relates to a monitoring unit and a computer program.
The use of cameras for various types of monitoring, both in industry and in private dwellings, is already known. The aim of the monitoring is often to prevent burglary and theft.
The camera takes pictures of a monitored area. The monitored area is limited by the optics of the camera. The recorded images are analyzed for an evaluation of their content to be made. If the camera monitors, for example, premises in which people are not permitted, an analysis is made of the recorded image and an evaluation made whether there is an extraneous object within the monitored area or not.
In a monitoring context the term scene is used. The scene changes, for example, is something moves physically within the monitored area, for example if a person enters the monitored area. On the other hand, the scene does not change if the light in the monitored area changes. If a change of scene is detected, it can be determined that there is an alarm situation.
The analysis of the recorded images can be carried out manually, by a person looking at a recorded image and making a visual evaluation about whether there is an intruder in the monitored area or not. If an intruder is discovered on a recorded image, the monitoring personnel who carries out the evaluation can, for example, telephone the police for further measures to be taken. This is an expensive form of monitoring, as it requires a person to go through the recorded images. Even if the person who carries out the evaluation of the recorded images can evaluate and monitor several monitored areas at the same time, it is time-consuming and very monotonous and stressful work, as an xe2x80x9ceventxe2x80x9d that is not permitted must not be missed in the recorded images. In addition to an intruder entering a building, an event that is not permitted can be an incorrectly manufactured bottle in a production line.
The analysis of the recorded images is therefore carried out to an increasing extent by means of digital image processing. In order to discover, for example, an intruder in a recorded image, the recorded image is compared with a reference image, which can be a background image that was recorded on a previous occasion when there was no intruder in the monitored area. The reference image can also be the immediately preceding recorded image. If there is a difference between the two compared images this can mean that there is an intruder in the monitored area. The difference can also be due to changes in the light in the monitored area, which for instance can arise when the sun goes behind a cloud, when it starts to get dark or when a light is switched on. One way of reducing the problem caused by changes in the light is to detect which changes concern changes in the light and which concern changes in the scene. This is solved by using different criteria for which changes in intensity are the result of changes in the light and which are the result of changes in the scene. This is a difficult problem to solve. The algorithms that are used are very complicated and take a long time to process.
Another problem of the prior-art technique is if changes in the light give rise to changes in intensity that do not follow the said criteria for changes in intensity. This occurs, for example, when there are objects in the scene that cast shadows. In this case, the changes in the light will be one way in the shadow and another way alongside.
An object of the present invention is therefore to provide a method that avoids the above-mentioned problems.
This object and other objects which will be apparent from the following description are achieved, according to a first aspect of the present invention, by a method, which is of the type described by way of introduction and is characterized by the step of creating the reference image by combining at least two previously stored images of a set of images, so that the lighting conditions in the reference image is adjusted to the lighting conditions in the recorded image.
Instead of first comparing the recorded image and the reference image to determine whether the image has changed and then deciding whether the change is an alarm situation or a change in the light, the changes in the light are now considered before the comparison is made. This is carried out by having previously stored images which can be combined and in this way can recreate the lighting conditions in the reference image. A new reference image can be created before each comparison with a recorded image. It is also possible to use the preceding reference image when the next image of the monitored area is recorded and is to be compared with a reference image. For example, a new reference image can be recreated every couple of minutes, or every fifth, tenth or hundredth time an image is recorded and is to be compared with a reference image. An advantage of the present invention is that an optimal reference image is obtained in a simple and quick way, which reference image takes the lighting conditions into account. This means that the step of comparing the recorded image and the reference image becomes simpler and requires less complex algorithms than must be used, for example, for the classification of areas according to changes in the light and changes in the scene. This also has the advantage that less memory is required. This is particularly important when there is limited processing capacity, which is the case in a system with distributed intelligence. Distributed intelligence means that an analysis of the recorded image is carried out in a monitoring unit at the monitored area to determine whether there is an alarm situation.
The result of the comparison is also more reliable as the risk of a false detection is reduced when a reference image according to the invention is used.
The monitoring can, for example, be carried out in premises where valuable documents are stored and in which people are not permitted, and aims at detecting whether a person is in the room or not. In order to be able to detect a person, an image is recorded and the area which the image covers is called the monitored area. The recorded image is compared with a reference image in order to discover whether a person has entered the monitored area. The reference image is an image that represents the background of the monitored area at the time of recording the image. The background of the monitored area can be declared as the monitored area when no object that can cause an alarm is in the monitored area, that is to say when the monitored area is undisturbed. The reference image is created by combining images which are stored in a set of images, so that the reference image is adjusted to the prevalent lighting conditions in the recorded image. The image information in the reference image is adjusted to the image information in the recorded image. The image information comprises the light intensity in the pixels of the image. The images in the set of images do not need to correspond individually to an actual light level for the scene. What is important is that it is possible to create a reference image for as many different types of light level as possible from a limited number of images. It can be possible to update the set of images when the lighting conditions in the recorded image cannot be recreated in the reference image from the set of images.
By combining images in a set of images, it is also possible to take into account shadows from fixed objects, which shadows are included in the reference image.
Another advantage is that the monitoring system is more robust and less sensitive to interference when the reference image is adjusted immediately to the prevalent lighting conditions and does not detect these separately afterwards.
In another preferred embodiment, the reference image is created by linear combination of said at least two images.
Linear combination means that a coefficient is calculated for each image in the set of images and the linear combination is created based on the calculated coefficients.
In order to adjust the reference image to the recorded image as well as possible, it is possible to use an algorithm that attempts to find the linear combination of the images in the set of images that conforms as well as possible to the light level in the recorded image.
In a further preferred embodiment, the method further comprises in addition the steps of calculating a difference image as the difference between the reference image and the recorded image, determining at least one divergence area in the difference image in which at least certain pixels exceed a particular level, determining whether the divergence area represents a scene change and, if the divergence area represents a scene change, taking out the pixels that correspond to the divergence area in the recorded image, for the creation of the next reference image, or in the reference image, before comparison with the recorded image.
The difference image can be derived as the difference in intensity between each pixel in the recorded image with each corresponding pixel in the reference image. By means of the difference image, it is possible to see whether, and if so where, there is a difference between the recorded image and the reference image. These differences can be apparent as a divergence area, which can be a number of pixels that exceed a predetermined threshold value and which are adjacent to each other. The number of divergence areas can be none, one or more. These divergence areas can be caused by scene changes, but they can also be caused, for example, by changes in the light. In order for an area in the difference image to be called a divergence area, there can be various criteria that have to be fulfilled. Examples of such criteria can be that the area must be of a certain size, that is it must occupy at least a predetermined number of pixels and/or that the intensity difference in a pixel in the recorded image and the reference image must exceed a particular level. Other criteria can, for example, be the shape of the area, that is to say how the pixels that exceed the threshold value abut each other.
If the divergence area is due to a scene change, this scene change will most probably be repeated in the next recorded image. In order to create as good a reference image as possible for this next recorded image, pixels corresponding to those that the divergence area occupies in the difference area are removed from the recorded image. The divergence area advantageously also comprises pixels that abut the pixels that fulfil one or more criteria for constituting a divergence area. By also removing these pixels, it is taken into account that the scene change may have moved in the monitored area before the recording of the next image. In this way, an even better reference image is obtained. How much the divergence area is enlarged can depend, for example, on how quickly it is expected that detected scene changes can move in the monitored area.
The removed pixels are given a light level that is dependent upon the light level of the other pixels and an estimate of the lighting conditions in the area occupied by the scene change is obtained.
An advantage of this method is that the reference image is created based on the prevalent lighting conditions without interference from scene changes.
A further advantage of this method is that a better reference image is obtained and that it is thus easier to detect objects in the recorded image.
Another advantage is that also less advanced algorithms are required, which in turn means that the calculation requires less processing capacity and less memory.
In one embodiment according to the invention, the method comprises the steps of determining whether the divergence area represents a change in the light and of updating the set of images if the divergence area represents a change in the light.
If the divergence area represents a change in the light, the light level in the recorded image could not be recreated from the set of images. New lighting conditions have been detected and the set of images is updated with these new lighting conditions. If the image differs significantly from the previous set of images, the base must be increased by a new image, but advantageously not with precisely the recorded image. Instead, what is important is that the new lighting conditions can be recreated with the set of images. The new set of images can be derived by using the recorded image plus the original set of images and performing a single value division (SVD). There are also other algorithms that can be used in this connection, such as the Grahm-Schmidt algorithm. If the base is orthogonal and the set of images is to be updated with a new image that corresponds to new lighting conditions, it is not sufficient simply to add the recorded image, as we wish to retain the orthogonal base. What is important is instead to be able to recreate the new lighting conditions with the new base. Using, for example, SVD it is possible to synthesize an image which is orthogonal to the others in the set of images.
According to a further preferred embodiment, the method comprises the step of updating the set of images if the divergence area represents a scene change and if the same scene change is detected in a predetermined number of successively recorded images.
Such a scene change is a persistent change and can, for example, be a flower-pot that has fallen on the floor. These persistent changes can be said to be non-critical changes of the scene. The number of images that is required in order to determine whether a persistent scene change has occurred is a matter of judgement. The number of images can also be measured in time as images can be recorded at predetermined intervals. It must not be the case that a burglar can be designated as a persistent scene change simply because he moves very slowly. For example, if a camera takes 10 images per second and a persistent scene change is defined as a change which lasts for one minute (or for three minutes) the number of images is 600. The updating can be carried out in such a way that a new set of images is created by discarding the old base and letting the most recently recorded image form a new set of images, which initially consists of only this one image.
The scene change can also be incorporated gradually, whereas updating for a new light level should be carried out more rapidly.
An advantage of this method is that a more correct reference image can be created.
In a preferred embodiment the step of determining whether the divergence area represents a scene change comprises calculating the variance of the divergence area, and if the variance exceeds a predetermined value it is determined that the divergence area represents a scene change.
The variance of a divergence area in the difference image is calculated. If the variance is large, it is a scene change. If the variance is small, the divergence area can, for example, be judged to be due to a change in the lighting. An advantage of using the variance to determine which type of change has occurred is that it is a simple method.
In another embodiment, at least the outermost edge of pixels in the recorded image is omitted when creating the reference image.
It is an advantage not to include the outermost edge or edges of pixels when calculating the reference image, as, for example, an intruder will appear first at the edge of the image. This interference will then not be included in the creation of the reference image and therefore will not affect the reference image.
In a preferred embodiment, the stored images are stored in a set of images at different resolutions.
An advantage of this is that it saves memory capacity, which is normally limited in a monitoring system. It is normally sufficient to store one or a few images at full resolution and the others at a considerably lower resolution.
In an embodiment according to the invention, the step of creating the set of images further comprises recording images of the monitored area in different lighting conditions and storing one or more of these recorded images.
When the monitoring system is put into operation, a very large set of light levels can be stored in the set of images. One way of creating such a set of images is to take a sequence of images when starting up the system. This sequence of images can be taken over a predetermined period of time. During this time the light level varies as much as possible. An advantage of using such a set of images is that when there is a difference between the recorded image and the reference image, it can be determined straight away whether the difference is a scene change. A further advantage of this way of creating the set of images is that the derivation of a reference image from the set of images is quick and easy to carry out. It can also be possible to update this type of set of images if new lighting conditions arise.
In one embodiment, the step of updating the set of images is carried out at predetermined intervals.
The whole set of images can advantageously be updated over time in order to prevent the set of images from becoming too large. That is to say that the set of images is updated so that it does not include lighting conditions that are not relevant. A time factor determines how long a time it is to take for the change to be incorporated in the base. For example, the updating can be carried out once an hour.
In a preferred embodiment of the invention, said at least two images in the set of images are stored orthogonally.
Storing images orthogonally means that the scalar product of each matrix that represents an image with itself is equal to one and that its scalar product with every other matrix that represents an image is equal to zero.
An advantage of storing the set of images as an orthogonal base is that a large number of light variations can be captured in a limited number of images. For example, the continuum of light variations produced by a dimmer can be captured with only two base images.
Another advantage of using an orthogonal base is that it is simpler and quicker to derive a reference image. The algorithms that are used can therefore be less complex and processing power is saved.
A further advantage is that there are effective algorithms for updating the orthogonal base when new lighting conditions are detected.
In an advantageous embodiment, the set of images comprises an image in which all the pixels have the same intensity.
An image in which all the pixels have the same intensity, that is to say that all the pixels have the same grayscale value, can be called a constant image. With a constant image, it is easy to capture variations where the whole scene is illuminated in the same way. Another advantage arises when intensity variations arise due, for example, to the exposure time being changed, as by using the constant image a monitoring unit can handle these settings automatically. This means that time-consuming manual settings are not required. A further advantage of using a constant image in comparison to, for example, calculating the intensity value of all the pixels with the same value, is that the calculation is quicker and easier.
According to a second aspect of the present invention, this relates to a monitoring unit for monitoring a monitored area, comprising a light-sensitive sensor which is arranged to record an image of the monitored area, and a central processing unit which is arranged to compare the recorded image with a reference image in order to determine whether there is an alarm situation, the central processing unit being further arranged to create a reference image by combining at least two previously stored images from a set of images, so that the lighting conditions in the reference image are adjusted to the lighting conditions in the recorded image.
The advantages of this monitoring unit are apparent from the discussion above.
According to third aspect of the present invention, this relates to a computer program for image processing when monitoring a monitored area, which computer program is stored on a computer-readable memory medium which comprises instructions for causing the computer to record an image of the monitored area and to compare the recorded image with a reference image in order to determine whether there is an alarm situation, which causes the computer to create a reference image by combining at least two previously stored images from a set of images, so that the lighting conditions in the reference image are adjusted to the lighting conditions in the recorded image.
The advantages of the computer program are apparent from the discussion above. The program is primarily intended to be installed in a monitoring unit which monitors a monitored area.